import './styles/index.css'
import {RESOURCES} from "./mock";
import {Resource} from "./types";

const resources: Resource[] = RESOURCES;

addEventListener('DOMContentLoaded', () => {
  const videoWrap = document.getElementById('video-wrap');
  if (videoWrap) {
    const videoTag = videoWrap.getElementsByTagName('video')[0];
    if (videoTag) {
      videoTag.setAttribute('src', resources[0].url);
      videoTag.addEventListener('loadeddata', () => {
        console.log('loadeddata');
      });
      videoTag.addEventListener('loadedmetadata', () => {
        console.log('loadedmetadata');
      });
      videoTag.addEventListener('canplay', () => {
        console.log('canplay');
      });
      videoTag.addEventListener('timeupdate', (event) => {
        console.log('timeupdate', videoTag.currentTime);
      });
      videoTag.addEventListener('complete', () => {
        console.log('complete');
      });
      videoTag.addEventListener('ended', () => {
        console.log('ended');
      });
    }
  }
});
